home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MACD 5
/
MACD 5.bin
/
workbench
/
blankery
/
blanker
/
source
/
blankers
/
interference
/
blank.c
next >
Wrap
C/C++ Source or Header
|
1993-08-15
|
3KB
|
77 lines
#include <exec/types.h>
#include <intuition/intuition.h>
#include <dos/dos.h>
#include <clib/exec_protos.h>
#include <clib/intuition_protos.h>
#include <clib/graphics_protos.h>
#include <clib/alib_protos.h>
#include "/defs.h"
extern ULONG Depth, Mode;
UWORD Colors5[] = { 0x0F20, 0x0E30, 0x0C50, 0x0B60, 0x0980, 0x0890, 0x06B0, 0x05C0, 0x03E0, 0x02F0, 0x00F2,
0x00E3, 0x00C5, 0x00B6, 0x0098, 0x006B, 0x005C, 0x003E, 0x002F, 0x020F, 0x030E, 0x050C, 0x060B, 0x0809,
0x0908, 0x0B06, 0x0C05, 0x0E03, 0x0F02, 0x0F00 }, Colors4[] = { 0x0E03, 0x0B06, 0x0909, 0x060B, 0x030E,
0x003E, 0x006B, 0x0099, 0x00B6, 0x00E3, 0x03E0, 0x06B0, 0x0990, 0x0B60, 0x0E30 }, Colors3[] = { 0x0E00,
0x0770, 0x00E0, 0x0077, 0x000E, 0x0707 }, Colors2[] = { 0x0E00, 0x00E0, 0x000E }, Colors1[] = { 0x0FFF },
*Table[5];
VOID CycleColors( struct Screen *Scr, ULONG Depth )
{
static ULONG pos = 0;
ULONG i, j = 0, Colors = ( 1L << Depth ) - 1;
SetRGB4(&( Scr->ViewPort ), 0, 0, 0, 0 );
for( i = pos; j < Colors; i = ++i % Colors )
SetRGB4(&( Scr->ViewPort ), ++j, ( Table[Depth-1][i] & 0x0F00 ) >> 8,
( Table[Depth-1][i] & 0x00F0 ) >> 4, Table[Depth-1][i] & 0x000F);
pos = ++pos % Colors;
}
VOID Interference( struct Screen *Scr )
{
LONG x, y, factor, mod = ( 1L << Depth ) - 1;
WORD Wid = Scr->Width, Hei = Scr->Height;
ScreenToFront( Scr );
factor = RangeRand( 20 ) + 1;
for( y = -Hei / 2 + 1; ( y <= 0 ) && (!( SetSignal( 0L, 0L ) & SIGBREAKF_CTRL_C )); y++ ) {
for( x = -Wid / 2 + 1; x <= 0; x++ ) {
SetAPen( &( Scr->RastPort ), (UBYTE)(((( x * x + y * y ) / factor ) % mod ) + 1 ));
WritePixel( &( Scr->RastPort ), (SHORT)( Wid / 2 - 1 + x ), (SHORT)( Hei / 2 - 1 + y ));
WritePixel( &( Scr->RastPort ), (SHORT)( Wid / 2 - 1 - x ), (SHORT)( Hei / 2 - 1 + y ));
WritePixel( &( Scr->RastPort ), (SHORT)( Wid / 2 - 1 + x ), (SHORT)( Hei / 2 - 1 - y ));
WritePixel( &( Scr->RastPort ), (SHORT)( Wid / 2 - 1 - x ), (SHORT)( Hei / 2 - 1 - y ));
}
}
for( x = 0; x < 400 && (!( SetSignal( 0L, 0L ) & SIGBREAKF_CTRL_C )); x++ ) {
WaitTOF();
CycleColors( Scr, Depth );
}
}
VOID blank( VOID )
{
struct Screen *Scr;
if( Scr = OpenScreenTags( NULL, SA_Depth, Depth, SA_Overscan, OSCAN_STANDARD, SA_DisplayID, Mode, SA_Quiet,
TRUE, SA_Behind, TRUE, TAG_DONE )) {
Table[0] = Colors1; Table[1] = Colors2; Table[2] = Colors3; Table[3] = Colors4; Table[4] = Colors5;
CycleColors( Scr, Depth );
SetRast(&( Scr->RastPort ), 0 );
BlankMousePointer();
while(!( SetSignal( 0L, 0L ) & SIGBREAKF_CTRL_C )) Interference( Scr );
SetSignal( 0L, SIGBREAKF_CTRL_C );
UnblankMousePointer();
CloseScreen( Scr );
}
}